
chrome.runtime.onInstalled.addListener(function(){
    var menuId = chrome.contextMenus.create({
        "title":"评论搜索",
        "id":"weiboSC",
        "contexts":["all"]
    });
    chrome.contextMenus.onClicked.addListener(function(info, tab){
        if(info.menuItemId=="weiboSC"){
            chrome.tabs.sendMessage(tab.id,{search_C:"true"},
                function(response){
                    console.log(response.receive);
            });
        }
    });
    chrome.tabs.onUpdated.addListener(function(tabId,changeInfo,tab){
        chrome.contextMenus.onClicked.addListener(function(info, tab){
            if(info.menuItemId=="weiboSC"){
                chrome.tabs.sendMessage(tab.id,{search_C:"true"},
                    function(response){
                        console.log(response.receive);
                });
            }
        });
    });
});
